/*************************************************init*****************************/
  function query_goodsType(page) {
	sys_loading();
	var parm = $('#queryGoodsTypeForm').serialize() + (page != null ? ('&page=' + page) : '');
	var url = create_url('goodsType-query');
	
	$.ajax({type:'POST', url:url, data:parm,
		success: function(result) {
			sys_loading_close();
			$('#goodsTypeResultList').html(result);
		}
	});
}


  
  function save_goodsType() {
		var parm = $('#editGoodsTypeForm').serialize();
		var url = create_url('goodsType-save');
		sys_submiting();
		$.ajax({type:'POST', url:url, data:parm,
			success: function(result) {
				sys_submiting_close();
				if (result == 'success') {
					sys_msg('操作成功!');
					sys_load_handle('goodsType');
				} else if(result == 'exists'){
					sys_msg('已经有这个类型了!');
				} else {
					sys_msg('操作失败!');
				}
			}
		});
	}
  
  
  function shield_goodeType(code, name) {
		$.Zebra_Dialog('确定是否屏蔽'+name + ' 类型吗？',{
		'type': 'question',
		'title': '警告' ,
		'buttons':[
	       {caption:'屏蔽',callback:function() {
	    	   var url = create_url('goodsType-shield');
	    	   aidExecute_goodsType(code, url);
			}},
	       {caption:'取消',callback:function(){}
	       }]
		});
	}
  
  
  
  function aidExecute_goodsType(code, url) {
		var parm = {'code':code};
		sys_submiting();
		$.ajax({type:'POST', url:url, data:parm,
			success: function(result) {
				sys_submiting_close();
				if ('success' == result) {
					query_goodsType();
				} else {
					sys_msg('操作失败，请刷新页面再次尝试，如果问题依然存在，请联系管理员!');
				}
			}
		});
	}
  

  function delete_goodeType(code, name) {
		$.Zebra_Dialog('确认要删除吗？',{
		'type': 'question','title': '警告' ,'buttons':[
           {caption:'确认',callback:function() {
    			var url = create_url('goodsType-delete');
				var parm = {'code':code};
				sys_submiting();
				$.ajax({type:'POST', url:url, data:parm,
					success: function(result) {
						sys_submiting_close();
						sys_load_handle('goodsType');
						}
					});
	    		}},
	           {caption:'取消',callback:function(){}
	    	}]
		});
	}
  
  
  function selectParent_goodsType(code) {
		var url = create_url('goodsType-aidInit');
		var parm = {'id':'pc', 'name':'pname','code':code};
		$.colorbox({overlayClose:false, href:url, data:parm, close:'[关闭]', width:'800px', height:'600px', open:true});
	}
